<?php echo $this->render('/public/header'); ?>
<script src="https://cdn.bootcss.com/element-ui/1.4.2/index.js"></script>
<link href="https://cdn.bootcss.com/element-ui/1.4.2/theme-default/index.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/jquery-validate/1.17.0/jquery.validate.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-validate/1.17.0/localization/messages_zh.min.js"></script>
<style>
    .error{color:red;}
</style>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="main">
    <form id="form" name="form" role="form" method="post" action="">
        <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
            <div class="form-group">
                <label for="exampleInputEmail1">日期</label>
                <input type="date" v-model="date" class="form-control" />
            </div>
            <div class="form-group">
                <label for="exampleInputEmail1" >客户名称</label>
                <br/>
                <el-autocomplete
                popper-class="my-autocomplete"
                v-model="customer_name"
                :fetch-suggestions="querySearch"
                placeholder="搜索客户"
                style="width:100%"
                name="customer_name"
                @select="handleSelect"
                ></el-autocomplete>
            </div>
            <div class="form-group">
                <label for="exampleInputEmail1">客户编号</label>
                <input type="text" class="form-control" v-model="customer_num">
            </div>

            <div class="form-group">
                <label for="exampleInputEmail1">invoice编号</label>
                <input type="text" class="form-control" v-model="invoice" required name="invoice">
            </div>
            <div class="form-group">
                <label for="exampleInputEmail1">进仓编号</label>
                <input type="text" class="form-control" v-model="order_num" required name="order_num">
            </div>
            <div class="form-group">
                <label for="exampleInputEmail1">数量</label>
                <input type="text" class="form-control" v-model="num">
            </div>
            <div class="form-group">
                <label for="exampleInputEmail1">体积</label>
                <input type="text" class="form-control" v-model="volume">
            </div>
            <div class="form-group">
                <label for="exampleInputEmail1">运费</label>
                <input type="number" class="form-control" v-model="ship_fee">
            </div>
            <div class="form-group">
                <label for="exampleInputEmail1">进仓费</label>
                <input type="number" class="form-control" v-model="in_repo_fee" required name="in_repo_fee">
            </div>
            <div class="form-group">
                <label for="exampleInputEmail1">备注</label>
                <el-input
                type="textarea"
                autosize
                placeholder="请输入内容"
                v-model="remark"
                ></el-input>
            </div>
            <button class="btn btn-success">添加</button>
        </div>
    </form>
</div>
<script type="text/javascript">
    new Vue({
        el: "#main",
        data:
        {
            date:"<?php echo date('Y-m-d');?>",
            customer_name:"",
            customer_num:"",
            invoice:"",
            order_num:"",//进仓编号
            num:"",//数量
            volume:"",//体积
            ship_fee:"",//运费
            in_repo_fee:"",//进仓费
            total_fee:"",//总计
            remark:""
        },
        methods:
        {
            querySearch:function(str,cb)
            {
                var url = '/api/search_customer_by_like';
                $.post(url,{name:str},function(res){
                    if(res.code==1){
                        cb(res.data);
                    }
                },'json')
            },
            handleSelect:function(item){
                this.customer_num = item.number;
            }

        }
    })

    $.validator.setDefaults({
        submitHandler: function() 
        {
            alert(111);
        }
    })
    $().ready(function() {
            $("#form").validate();
        });

</script>
<?php echo $this->render('/public/footer'); ?>